package com.cipta.lomob;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.Window;

import com.cipta.lomob.fragments.DetilVideoFragment;
import com.cipta.lomob.model.ItemVideo;

public class VideoDetailActivity  extends FragmentActivity{
	private static final int SHOW_VIDEO = 11111;
	private FragmentManager ftManager;
	private DetilVideoFragment videoDetail;

	@Override
	protected void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_video);
		ftManager = getSupportFragmentManager();
		//get video item
		ItemVideo video = (ItemVideo) getIntent().getExtras().getSerializable("video");
		videoDetail = new DetilVideoFragment(video);
		FragmentTransaction transaction = ftManager.beginTransaction();
		transaction.replace(R.id.frame_container, videoDetail);
		transaction.commit();
	}
	
	
	public static void showVideo(Activity activity, ItemVideo currentVideo){
		Intent intent = new Intent(activity, VideoDetailActivity.class);
		intent.putExtra("video",currentVideo);
		activity.startActivityForResult(intent, SHOW_VIDEO);
	}
	 	
	

}
